package net.huashitong.index.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.index.dao.IndexTargetDao;
import net.huashitong.index.dataModel.IndexTargetDataModel;
import net.huashitong.index.entity.IndexTargetEntity;
import net.huashitong.index.filter.IndexTargetFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IndexTargetService extends StringPKService<IndexTargetEntity> {

    @Autowired
    private IndexTargetDao dao;
    @Autowired
    private SysTableService sysTableService;

    @Override
    protected BaseDao<IndexTargetEntity, String> getDao() {
        return dao;
    }
    @Override
    protected void beforeSave(IndexTargetEntity obj) {
        obj.setSysId(sysTableService.updateMaxSysId("t_eco_indextarget",null));
    }


    /**
     * 主查询入口
     * @param filter
     * @return
     */
    public List<IndexTargetDataModel> queryByFilter(IndexTargetDataModel filter){
        return dao.queryByFilter(filter);
    }


}
